# RELEASE DEBUG
export buildType=$1
branch=$2
logFile="-"
basePath="/Users/irre/Desktop/mateurp"
projectPath=${basePath}/mateurp
unity=/Applications/Unity/Hub/Editor/2022.3.61f1c1/Unity.app/Contents/MacOS/Unity
cd $basePath

# Update Code
echo Update Code Start
git checkout $branch
git fetch origin || exit 1
git reset --hard "origin/$branch" || exit 1
# Update Code Finish

# GenerateAll
echo GenerateAll Start
$unity -batchmode -nographics -quit -projectPath $projectPath -buildTarget $buildType -executeMethod HybridCLR.Editor.BuildAssetsCommand.Prebuild -logFile $logFile || exit 1
echo GenerateAll Finish

# BuildArts
echo BuildArts Start
rm -rf $projectPath/HybridCLRBuildCache/ArtPackages
rm -rf $projectPath/ArtPackages
$unity -batchmode -nographics -quit -projectPath $projectPath -executeMethod HybridCLR.Editor.BuildAssetsCommand.BuildArtAB -logFile $logFile || exit 1
echo BuildArts Finish